home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / UTILREEN / PRNTUTIL.LZH / SETD.ASM < prev    next >
Assembly Source File  |  1980-01-01  |  8KB  |  152 lines

  1. ;         SETP.ASM
  2. ;         This is code for the IBM PC et al that provides a menu driven
  3. ;         set-up routine for the Star Delta 10 printer. Alternately, a
  4. ;         command tail can be used, using the same codes as given in the menu.
  5. ;         This program is placed in the public domain and is written by
  6. ;         Joseph C. Hudson, 4198 Warbler Dr. Flint, MI 48504
  7. ;         Adapted from GEMSET.ASM by
  8. ;         R.R.Jones 226 Valley Rd. Lawrenceville, Ga. 30245 MNet 70270,117
  9.  
  10.           cr     equ 0Dh
  11.           lf     equ 0Ah
  12.           conout equ 9
  13.           getcon equ 7
  14.  
  15.           setp   segment byte
  16.  
  17.           assume cs:setp
  18.           org    100h                  ;Setup as COM file
  19. begin:    jmp    start                 ;Skip over data area
  20.           comnd  db  ?                 ;variable to hold command
  21.           istail db  ?                 ;dummy variable for tail
  22.           numrem db  ?                 ;var for no of chars still in tail
  23.           banner db  cr,lf,lf,lf,lf,lf,'       '
  24.                  db ' (A) Pica (10)                     (J) Cancel Italics'
  25.                  db cr,lf,lf,'       '
  26.               db ' (B) Elite (12)                    (K) Skip Over Perf 2 Lines'
  27.                  db cr,lf,lf,'       '
  28.                db ' (C) Condensed (17)                (L) Set Left Margin at 10'
  29.                  db cr,lf,lf,'       '
  30.                  db ' (D) Unidirectional Printing       (M) Expanded Print'
  31.                  db cr,lf,lf,'       '
  32.                  db ' (E) Emphasized                    (N) Cancel Expanded'
  33.                  db cr,lf,lf,'       '
  34.                  db ' (F) Cancel Emphasized             (O) Top Margin 2 Lines'
  35.                  db cr,lf,lf,'       '
  36.                  db ' (G) Double Strike                 (P) Print Test Line'
  37.                  db cr,lf,lf,'       '
  38.                  db ' (H) Cancel Double Strike          (Q) Quit'
  39.                  db cr,lf,lf,'       '
  40.                  db ' (I) Italics                       (R) Reset Printer'
  41.                  db cr,lf,lf,'       '
  42.                  db '$'
  43.  
  44. ;*****************************************************************************
  45. ; Here begin the definitions of the printer control strings. This is a       *
  46. ; table where each entry begins with the unique search key formed in al      *
  47. ; by the routine "highbit", is followed in memory by the actual printer      *
  48. ; control codes, and ends with a zero. When the key is found the lineprinter *
  49. ; will be sent everthing after the key, up to the zero which is the "stopper"*
  50. ;*****************************************************************************
  51.  
  52.           ptable db 225,27,'B',1,-1    ;A - Each code group must end in -1
  53.                  db 226,27,'B',2,-1    ;B
  54.                  db 227,27,'B',3,-1    ;C
  55.                  db 228,27,'U',1,-1    ;D
  56.                  db 229,27,'E',-1      ;E
  57.                  db 230,27,'F',-1      ;F
  58.                  db 231,27,'G',-1      ;G
  59.                  db 232,27,'H',-1      ;H
  60.                  db 233,27,'4',-1      ;I
  61.                  db 234,27,'5',-1      ;J
  62.                  db 235,27,'N',2,-1    ;K
  63.                  db 236,27,'M',10,-1   ;L
  64.                  db 237,27,'W',1,-1    ;M
  65.                  db 238,27,'W',0,-1    ;N
  66.                  db 239,27,'R',2,-1    ;O
  67.                  db 240,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLNO',-1 ;P
  68.                  db 242,,27,'@',-1     ;R
  69.           endtable equ $
  70.           lentbl equ endtable - ptable ;Get length of printer string table
  71.  
  72. start:    mov    istail,0              ;set tail dummy to 0
  73.           mov    si,offset 80h         ;go to command tail
  74.           mov    al,[si]               ;get length of command tail
  75.           mov    numrem,al             ;put length of tail in numrem
  76. again:    cmp    numrem,0              ;is there any tail left?
  77.           jne    proceed               ;yes, proceed
  78.           cmp    istail,0              ;no, was there a tail?
  79.           je     start1                ;no, go get commands
  80.           jmp    quit                  ;yes, all done, so quit.
  81. proceed:  inc    si                    ;point at next character in tail
  82.           dec    numrem                ;decrement counter
  83.           mov    al,[si]               ;get next character from tail
  84.           or     al,20h                ;make it lower case
  85.           cmp    al,60h                ;is it below a?
  86.           jle    again                 ;yes, so not a letter
  87.           cmp    al,73h                ;no. is it above r?
  88.           jge    again                 ;yes, so not a command
  89.           mov    istail,1              ;no, is a command. Set dummy to 1
  90.           jmp    chkq                  ;process the command
  91.  
  92. start1:   mov    dx,offset banner      ;point to banner
  93.           mov    ah,conout             ;write to console function
  94.           int    21h                   ;call DOS
  95.  
  96. keyget:   mov    ah,getcon             ;get character from keyboard
  97.           int    21h
  98.           or     al,20h                ;change to lower case
  99.           mov    dl,al
  100.           mov    ah,02h                ;write character to screen
  101.           int    21h
  102.  
  103. ; There is 1 special case - Q returns to DOS
  104.  
  105. chkq:     mov    bl,'q'                ;special handling for q
  106.           cmp    al,bl                 ;Does he want to quit now?
  107.           jne    highbit               ;No, not a q, check other possibilities
  108.  
  109. quit:     call   crlf                  ;Send cr and lf to printer
  110.           mov    ah,4ch                ; and quit.
  111.           int    21h
  112.  
  113. highbit:  mov    comnd,al              ;save command
  114.           or     al,10000000b          ;setup search key
  115.           mov    di,offset ptable      ;setup to see table
  116.           mov    cx,lentbl             ;get length of table into counter
  117. next:     mov    ah,[di]               ;take table entry
  118.           cmp    al,ah                 ;is this equal to search key?
  119.           je     gotpntr               ;yes, now send string to printer
  120.           dec    cx                    ;no, continue search , dec counter
  121.           jcxz   keyget                ;if counter is 0 not a legal search key
  122.           inc    di                    ;one deeper into table, please
  123.           jmp    next                  ;and look at another table byte
  124. gotpntr:  inc    di                    ;Bump past key
  125.           mov    dl,[di]               ;take byte in to be sent to printer
  126.           mov    dh,-1                 ;set up to see if end of print string
  127.           cmp    dl,dh                 ;set zero flag if so
  128.           je     lpfin                 ;yes, all done, finish up printer
  129.           mov    ah,5                  ;pr inter code
  130.           int    21h
  131.           jmp    gotpntr               ;get next printer string byte
  132. lpfin:    mov    al,comnd              ;get command back
  133.           cmp    al,'p'                ;did we print test line?
  134.           jne    nextone               ;no, continue
  135.           call   crlf                  ;yes, send cr and lf to printer
  136. nextone:  cmp    istail,0              ;do we have a tail?
  137.           je     keyget                ;no, go wait for command
  138.           jmp    again                 ;yes, continue processing tail
  139.  
  140. crlf      proc   near                  ;send cr and lf to printer
  141.           mov    ah,5                  ;printer function number
  142.           mov    dl,cr                 ;put cr in dl
  143.           int    21h                   ;call DOS
  144.           mov    ah,5
  145.           mov    dl,lf                 ;put lf in dl
  146.           int    21h                   ;call DOS
  147.           ret
  148. crlf      endp
  149.  
  150. setp      ends
  151. end       begin
  152.